﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using PS.DBUtility;
using System.Collections.Generic;
namespace PS.DAL
{
    /// <summary>
    /// 数据访问类:ExamSysParaWeight
    /// </summary>
    public partial class ExamSysParaWeight
    {
        public ExamSysParaWeight()
        { }
        #region  Method
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int ExamSysParaWeightID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from ExamSysParaWeight");
            strSql.Append(" where ExamSysParaWeightID=@ExamSysParaWeightID");
            SqlParameter[] parameters = {
					new SqlParameter("@ExamSysParaWeightID", SqlDbType.Int,4)
};
            parameters[0].Value = ExamSysParaWeightID;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(PS.Model.ExamSysParaWeight model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into ExamSysParaWeight(");
            strSql.Append("ExamSysParaID,WeightType,Level1,Level2,Level3,Level4,Level5,Level6,Level7,Level8,Level9,ManageKnowledge,ArticleWrite,SpecialKnowledge,Creator,CreateTime,Editor,EditTime,DispOrder,ValidMark,Spare1,Spare2,Spare3,Spare4,SpareDecimal5,SpareDecimal6,SpareDecimal7,SpareDecimal8)");
            strSql.Append(" values (");
            strSql.Append("@ExamSysParaID,@WeightType,@Level1,@Level2,@Level3,@Level4,@Level5,@Level6,@Level7,@Level8,@Level9,@ManageKnowledge,@ArticleWrite,@SpecialKnowledge,@Creator,@CreateTime,@Editor,@EditTime,@DispOrder,@ValidMark,@Spare1,@Spare2,@Spare3,@Spare4,@SpareDecimal5,@SpareDecimal6,@SpareDecimal7,@SpareDecimal8)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@ExamSysParaID", SqlDbType.Int,4),
					new SqlParameter("@WeightType", SqlDbType.SmallInt,2),
					new SqlParameter("@Level1", SqlDbType.Decimal,9),
					new SqlParameter("@Level2", SqlDbType.Decimal,9),
					new SqlParameter("@Level3", SqlDbType.Decimal,9),
					new SqlParameter("@Level4", SqlDbType.Decimal,9),
					new SqlParameter("@Level5", SqlDbType.Decimal,9),
					new SqlParameter("@Level6", SqlDbType.Decimal,9),
					new SqlParameter("@Level7", SqlDbType.Decimal,9),
					new SqlParameter("@Level8", SqlDbType.Decimal,9),
					new SqlParameter("@Level9", SqlDbType.Decimal,9),
					new SqlParameter("@ManageKnowledge", SqlDbType.Decimal,9),
					new SqlParameter("@ArticleWrite", SqlDbType.Decimal,9),
					new SqlParameter("@SpecialKnowledge", SqlDbType.Decimal,9),
					new SqlParameter("@Creator", SqlDbType.VarChar,20),
					new SqlParameter("@CreateTime", SqlDbType.DateTime),
					new SqlParameter("@Editor", SqlDbType.VarChar,20),
					new SqlParameter("@EditTime", SqlDbType.DateTime),
					new SqlParameter("@DispOrder", SqlDbType.Int,4),
					new SqlParameter("@ValidMark", SqlDbType.Int,4),
					new SqlParameter("@Spare1", SqlDbType.VarChar,200),
					new SqlParameter("@Spare2", SqlDbType.VarChar,200),
					new SqlParameter("@Spare3", SqlDbType.VarChar,200),
					new SqlParameter("@Spare4", SqlDbType.VarChar,200),
					new SqlParameter("@SpareDecimal5", SqlDbType.Decimal,9),
					new SqlParameter("@SpareDecimal6", SqlDbType.Decimal,9),
					new SqlParameter("@SpareDecimal7", SqlDbType.Decimal,9),
					new SqlParameter("@SpareDecimal8", SqlDbType.Decimal,9)};
            parameters[0].Value = model.ExamSysParaID;
            parameters[1].Value = model.WeightType;
            parameters[2].Value = model.Level1;
            parameters[3].Value = model.Level2;
            parameters[4].Value = model.Level3;
            parameters[5].Value = model.Level4;
            parameters[6].Value = model.Level5;
            parameters[7].Value = model.Level6;
            parameters[8].Value = model.Level7;
            parameters[9].Value = model.Level8;
            parameters[10].Value = model.Level9;
            parameters[11].Value = model.ManageKnowledge;
            parameters[12].Value = model.ArticleWrite;
            parameters[13].Value = model.SpecialKnowledge;
            parameters[14].Value = model.Creator;
            parameters[15].Value = model.CreateTime;
            parameters[16].Value = model.Editor;
            parameters[17].Value = model.EditTime;
            parameters[18].Value = model.DispOrder;
            parameters[19].Value = model.ValidMark;
            parameters[20].Value = model.Spare1;
            parameters[21].Value = model.Spare2;
            parameters[22].Value = model.Spare3;
            parameters[23].Value = model.Spare4;
            parameters[24].Value = model.SpareDecimal5;
            parameters[25].Value = model.SpareDecimal6;
            parameters[26].Value = model.SpareDecimal7;
            parameters[27].Value = model.SpareDecimal8;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(PS.Model.ExamSysParaWeight model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update ExamSysParaWeight set ");
            strSql.Append("ExamSysParaID=@ExamSysParaID,");
            strSql.Append("WeightType=@WeightType,");
            strSql.Append("Level1=@Level1,");
            strSql.Append("Level2=@Level2,");
            strSql.Append("Level3=@Level3,");
            strSql.Append("Level4=@Level4,");
            strSql.Append("Level5=@Level5,");
            strSql.Append("Level6=@Level6,");
            strSql.Append("Level7=@Level7,");
            strSql.Append("Level8=@Level8,");
            strSql.Append("Level9=@Level9,");
            strSql.Append("ManageKnowledge=@ManageKnowledge,");
            strSql.Append("ArticleWrite=@ArticleWrite,");
            strSql.Append("SpecialKnowledge=@SpecialKnowledge,");
            strSql.Append("Creator=@Creator,");
            strSql.Append("CreateTime=@CreateTime,");
            strSql.Append("Editor=@Editor,");
            strSql.Append("EditTime=@EditTime,");
            strSql.Append("DispOrder=@DispOrder,");
            strSql.Append("ValidMark=@ValidMark,");
            strSql.Append("Spare1=@Spare1,");
            strSql.Append("Spare2=@Spare2,");
            strSql.Append("Spare3=@Spare3,");
            strSql.Append("Spare4=@Spare4,");
            strSql.Append("SpareDecimal5=@SpareDecimal5,");
            strSql.Append("SpareDecimal6=@SpareDecimal6,");
            strSql.Append("SpareDecimal7=@SpareDecimal7,");
            strSql.Append("SpareDecimal8=@SpareDecimal8");
            strSql.Append(" where ExamSysParaWeightID=@ExamSysParaWeightID");
            SqlParameter[] parameters = {
					new SqlParameter("@ExamSysParaID", SqlDbType.Int,4),
					new SqlParameter("@WeightType", SqlDbType.SmallInt,2),
					new SqlParameter("@Level1", SqlDbType.Decimal,9),
					new SqlParameter("@Level2", SqlDbType.Decimal,9),
					new SqlParameter("@Level3", SqlDbType.Decimal,9),
					new SqlParameter("@Level4", SqlDbType.Decimal,9),
					new SqlParameter("@Level5", SqlDbType.Decimal,9),
					new SqlParameter("@Level6", SqlDbType.Decimal,9),
					new SqlParameter("@Level7", SqlDbType.Decimal,9),
					new SqlParameter("@Level8", SqlDbType.Decimal,9),
					new SqlParameter("@Level9", SqlDbType.Decimal,9),
					new SqlParameter("@ManageKnowledge", SqlDbType.Decimal,9),
					new SqlParameter("@ArticleWrite", SqlDbType.Decimal,9),
					new SqlParameter("@SpecialKnowledge", SqlDbType.Decimal,9),
					new SqlParameter("@Creator", SqlDbType.VarChar,20),
					new SqlParameter("@CreateTime", SqlDbType.DateTime),
					new SqlParameter("@Editor", SqlDbType.VarChar,20),
					new SqlParameter("@EditTime", SqlDbType.DateTime),
					new SqlParameter("@DispOrder", SqlDbType.Int,4),
					new SqlParameter("@ValidMark", SqlDbType.Int,4),
					new SqlParameter("@Spare1", SqlDbType.VarChar,200),
					new SqlParameter("@Spare2", SqlDbType.VarChar,200),
					new SqlParameter("@Spare3", SqlDbType.VarChar,200),
					new SqlParameter("@Spare4", SqlDbType.VarChar,200),
					new SqlParameter("@SpareDecimal5", SqlDbType.Decimal,9),
					new SqlParameter("@SpareDecimal6", SqlDbType.Decimal,9),
					new SqlParameter("@SpareDecimal7", SqlDbType.Decimal,9),
					new SqlParameter("@SpareDecimal8", SqlDbType.Decimal,9),
					new SqlParameter("@ExamSysParaWeightID", SqlDbType.Int,4)};
            parameters[0].Value = model.ExamSysParaID;
            parameters[1].Value = model.WeightType;
            parameters[2].Value = model.Level1;
            parameters[3].Value = model.Level2;
            parameters[4].Value = model.Level3;
            parameters[5].Value = model.Level4;
            parameters[6].Value = model.Level5;
            parameters[7].Value = model.Level6;
            parameters[8].Value = model.Level7;
            parameters[9].Value = model.Level8;
            parameters[10].Value = model.Level9;
            parameters[11].Value = model.ManageKnowledge;
            parameters[12].Value = model.ArticleWrite;
            parameters[13].Value = model.SpecialKnowledge;
            parameters[14].Value = model.Creator;
            parameters[15].Value = model.CreateTime;
            parameters[16].Value = model.Editor;
            parameters[17].Value = model.EditTime;
            parameters[18].Value = model.DispOrder;
            parameters[19].Value = model.ValidMark;
            parameters[20].Value = model.Spare1;
            parameters[21].Value = model.Spare2;
            parameters[22].Value = model.Spare3;
            parameters[23].Value = model.Spare4;
            parameters[24].Value = model.SpareDecimal5;
            parameters[25].Value = model.SpareDecimal6;
            parameters[26].Value = model.SpareDecimal7;
            parameters[27].Value = model.SpareDecimal8;
            parameters[28].Value = model.ExamSysParaWeightID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int ExamSysParaWeightID)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from ExamSysParaWeight ");
            strSql.Append(" where ExamSysParaWeightID=@ExamSysParaWeightID");
            SqlParameter[] parameters = {
					new SqlParameter("@ExamSysParaWeightID", SqlDbType.Int,4)
};
            parameters[0].Value = ExamSysParaWeightID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool DeleteList(string ExamSysParaWeightIDlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from ExamSysParaWeight ");
            strSql.Append(" where ExamSysParaWeightID in (" + ExamSysParaWeightIDlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public PS.Model.ExamSysParaWeight GetModel(int ExamSysParaWeightID)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 ExamSysParaWeightID,ExamSysParaID,WeightType,Level1,Level2,Level3,Level4,Level5,Level6,Level7,Level8,Level9,ManageKnowledge,ArticleWrite,SpecialKnowledge,Creator,CreateTime,Editor,EditTime,DispOrder,ValidMark,Spare1,Spare2,Spare3,Spare4,SpareDecimal5,SpareDecimal6,SpareDecimal7,SpareDecimal8 from ExamSysParaWeight ");
            strSql.Append(" where ExamSysParaWeightID=@ExamSysParaWeightID");
            SqlParameter[] parameters = {
					new SqlParameter("@ExamSysParaWeightID", SqlDbType.Int,4)
};
            parameters[0].Value = ExamSysParaWeightID;

            PS.Model.ExamSysParaWeight model = new PS.Model.ExamSysParaWeight();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ExamSysParaWeightID"].ToString() != "")
                {
                    model.ExamSysParaWeightID = int.Parse(ds.Tables[0].Rows[0]["ExamSysParaWeightID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ExamSysParaID"].ToString() != "")
                {
                    model.ExamSysParaID = int.Parse(ds.Tables[0].Rows[0]["ExamSysParaID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["WeightType"].ToString() != "")
                {
                    model.WeightType = int.Parse(ds.Tables[0].Rows[0]["WeightType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Level1"].ToString() != "")
                {
                    model.Level1 = decimal.Parse(ds.Tables[0].Rows[0]["Level1"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Level2"].ToString() != "")
                {
                    model.Level2 = decimal.Parse(ds.Tables[0].Rows[0]["Level2"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Level3"].ToString() != "")
                {
                    model.Level3 = decimal.Parse(ds.Tables[0].Rows[0]["Level3"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Level4"].ToString() != "")
                {
                    model.Level4 = decimal.Parse(ds.Tables[0].Rows[0]["Level4"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Level5"].ToString() != "")
                {
                    model.Level5 = decimal.Parse(ds.Tables[0].Rows[0]["Level5"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Level6"].ToString() != "")
                {
                    model.Level6 = decimal.Parse(ds.Tables[0].Rows[0]["Level6"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Level7"].ToString() != "")
                {
                    model.Level7 = decimal.Parse(ds.Tables[0].Rows[0]["Level7"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Level8"].ToString() != "")
                {
                    model.Level8 = decimal.Parse(ds.Tables[0].Rows[0]["Level8"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Level9"].ToString() != "")
                {
                    model.Level9 = decimal.Parse(ds.Tables[0].Rows[0]["Level9"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ManageKnowledge"].ToString() != "")
                {
                    model.ManageKnowledge = decimal.Parse(ds.Tables[0].Rows[0]["ManageKnowledge"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ArticleWrite"].ToString() != "")
                {
                    model.ArticleWrite = decimal.Parse(ds.Tables[0].Rows[0]["ArticleWrite"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SpecialKnowledge"].ToString() != "")
                {
                    model.SpecialKnowledge = decimal.Parse(ds.Tables[0].Rows[0]["SpecialKnowledge"].ToString());
                }
                model.Creator = ds.Tables[0].Rows[0]["Creator"].ToString();
                if (ds.Tables[0].Rows[0]["CreateTime"].ToString() != "")
                {
                    model.CreateTime = DateTime.Parse(ds.Tables[0].Rows[0]["CreateTime"].ToString());
                }
                model.Editor = ds.Tables[0].Rows[0]["Editor"].ToString();
                if (ds.Tables[0].Rows[0]["EditTime"].ToString() != "")
                {
                    model.EditTime = DateTime.Parse(ds.Tables[0].Rows[0]["EditTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DispOrder"].ToString() != "")
                {
                    model.DispOrder = int.Parse(ds.Tables[0].Rows[0]["DispOrder"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ValidMark"].ToString() != "")
                {
                    model.ValidMark = int.Parse(ds.Tables[0].Rows[0]["ValidMark"].ToString());
                }
                model.Spare1 = ds.Tables[0].Rows[0]["Spare1"].ToString();
                model.Spare2 = ds.Tables[0].Rows[0]["Spare2"].ToString();
                model.Spare3 = ds.Tables[0].Rows[0]["Spare3"].ToString();
                model.Spare4 = ds.Tables[0].Rows[0]["Spare4"].ToString();
                if (ds.Tables[0].Rows[0]["SpareDecimal5"].ToString() != "")
                {
                    model.SpareDecimal5 = decimal.Parse(ds.Tables[0].Rows[0]["SpareDecimal5"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SpareDecimal6"].ToString() != "")
                {
                    model.SpareDecimal6 = decimal.Parse(ds.Tables[0].Rows[0]["SpareDecimal6"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SpareDecimal7"].ToString() != "")
                {
                    model.SpareDecimal7 = decimal.Parse(ds.Tables[0].Rows[0]["SpareDecimal7"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SpareDecimal8"].ToString() != "")
                {
                    model.SpareDecimal8 = decimal.Parse(ds.Tables[0].Rows[0]["SpareDecimal8"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ExamSysParaWeightID,ExamSysParaID,WeightType,Level1,Level2,Level3,Level4,Level5,Level6,Level7,Level8,Level9,ManageKnowledge,ArticleWrite,SpecialKnowledge,Creator,CreateTime,Editor,EditTime,DispOrder,ValidMark,Spare1,Spare2,Spare3,Spare4,SpareDecimal5,SpareDecimal6,SpareDecimal7,SpareDecimal8 ");
            strSql.Append(" FROM ExamSysParaWeight ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" ExamSysParaWeightID,ExamSysParaID,WeightType,Level1,Level2,Level3,Level4,Level5,Level6,Level7,Level8,Level9,ManageKnowledge,ArticleWrite,SpecialKnowledge,Creator,CreateTime,Editor,EditTime,DispOrder,ValidMark,Spare1,Spare2,Spare3,Spare4,SpareDecimal5,SpareDecimal6,SpareDecimal7,SpareDecimal8 ");
            strSql.Append(" FROM ExamSysParaWeight ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        public DataSet GetListBySqlString(string sqlString)
        {
            return DbHelperSQL.Query(sqlString);
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "ExamSysParaWeight";
            parameters[1].Value = "ExamSysParaWeightID";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  Method

 

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<PS.Model.ExamSysParaWeight> GetListModel(string strWhere)
        {
            List<PS.Model.ExamSysParaWeight> results = new List<PS.Model.ExamSysParaWeight>();
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * ");
            strSql.Append(" FROM ExamSysParaWeight ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    results.Add(GetModelByDataRow(dr));
                }
            }
            else
            {
                return null;
            }
            return results;
        }


        public PS.Model.ExamSysParaWeight GetModelByDataRow(DataRow dr)
        {
            PS.Model.ExamSysParaWeight model = new PS.Model.ExamSysParaWeight();
            if (dr["ExamSysParaWeightID"].ToString() != "")
            {
                model.ExamSysParaWeightID = int.Parse(dr["ExamSysParaWeightID"].ToString());
            }
            if (dr["ExamSysParaID"].ToString() != "")
            {
                model.ExamSysParaID = int.Parse(dr["ExamSysParaID"].ToString());
            }
            if (dr["WeightType"].ToString() != "")
            {
                model.WeightType = int.Parse(dr["WeightType"].ToString());
            }
            if (dr["Level1"].ToString() != "")
            {
                model.Level1 = decimal.Parse(dr["Level1"].ToString());
            }
            if (dr["Level2"].ToString() != "")
            {
                model.Level2 = decimal.Parse(dr["Level2"].ToString());
            }
            if (dr["Level3"].ToString() != "")
            {
                model.Level3 = decimal.Parse(dr["Level3"].ToString());
            }
            if (dr["Level4"].ToString() != "")
            {
                model.Level4 = decimal.Parse(dr["Level4"].ToString());
            }
            if (dr["Level5"].ToString() != "")
            {
                model.Level5 = decimal.Parse(dr["Level5"].ToString());
            }
            if (dr["Level6"].ToString() != "")
            {
                model.Level6 = decimal.Parse(dr["Level6"].ToString());
            }
            if (dr["Level7"].ToString() != "")
            {
                model.Level7 = decimal.Parse(dr["Level7"].ToString());
            }
            if (dr["Level8"].ToString() != "")
            {
                model.Level8 = decimal.Parse(dr["Level8"].ToString());
            }
            if (dr["Level9"].ToString() != "")
            {
                model.Level9 = decimal.Parse(dr["Level9"].ToString());
            }
            if (dr["ManageKnowledge"].ToString() != "")
            {
                model.ManageKnowledge = decimal.Parse(dr["ManageKnowledge"].ToString());
            }
            if (dr["ArticleWrite"].ToString() != "")
            {
                model.ArticleWrite = decimal.Parse(dr["ArticleWrite"].ToString());
            }
            if (dr["SpecialKnowledge"].ToString() != "")
            {
                model.SpecialKnowledge = decimal.Parse(dr["SpecialKnowledge"].ToString());
            }
            model.Creator = dr["Creator"].ToString();
            if (dr["CreateTime"].ToString() != "")
            {
                model.CreateTime = DateTime.Parse(dr["CreateTime"].ToString());
            }
            model.Editor = dr["Editor"].ToString();
            if (dr["EditTime"].ToString() != "")
            {
                model.EditTime = DateTime.Parse(dr["EditTime"].ToString());
            }
            if (dr["DispOrder"].ToString() != "")
            {
                model.DispOrder = int.Parse(dr["DispOrder"].ToString());
            }
            if (dr["ValidMark"].ToString() != "")
            {
                model.ValidMark = int.Parse(dr["ValidMark"].ToString());
            }
            model.Spare1 = dr["Spare1"].ToString();
            model.Spare2 = dr["Spare2"].ToString();
            model.Spare3 = dr["Spare3"].ToString();
            model.Spare4 = dr["Spare4"].ToString();
            if (dr["SpareDecimal5"].ToString() != "")
            {
                model.SpareDecimal5 = decimal.Parse(dr["SpareDecimal5"].ToString());
            }
            if (dr["SpareDecimal6"].ToString() != "")
            {
                model.SpareDecimal6 = decimal.Parse(dr["SpareDecimal6"].ToString());
            }
            if (dr["SpareDecimal7"].ToString() != "")
            {
                model.SpareDecimal7 = decimal.Parse(dr["SpareDecimal7"].ToString());
            }
            if (dr["SpareDecimal8"].ToString() != "")
            {
                model.SpareDecimal8 = decimal.Parse(dr["SpareDecimal8"].ToString());
            } 
            return model;
        }


    }
}

